import request from './request'

//获取首页数据
export const getHomeData = () => request.get('/index/index')

//获取popup里的数据
export const getPopUpData = () => request.get('/search/index')

// get请求带参数的形式
// axios.get('/user', {
//   params: {
//     ID: 12345
//   }
// })
// 
// post带参数的请求形式
// axios.post('/user', {
//   firstName: 'Fred',
//   lastName: 'Flintstone'
// })
//搜索框商品搜索
export const getSearchData = (params) => request.get('/goods/list', {
  params
})
// get请求的params需要解构，post的不用

//实时搜索功能接口
export const getSearchNowhData = (params) => request.get('/search/helper', {
  params
})

//清除历史记录请求
export const clearHistory = () => request.post('/search/clearhistory')

//登录请求
export const goLogin = (params) => request.post('/auth/loginByWeb', params)

//产品详情
export const getProductDetailData = (params) => request.get('/goods/detail', {
  params
})

//相关产品
export const getRelateProductData = (params) => request.get('/goods/related', {
  params
})

//获取购物车产品的数量 拦截器中带了token，不用传参数了
export const getCartNum = () => request.get('/cart/goodscount')

//加入购物车

export const addCart = (params) => request.post('/cart/add', params)

//获取购物车完整数据
export const getCartData = () => request.get('/cart/index')

//tarbar分类
//获取全部分类数据
export const getCategorytData = () => request.get('/catalog/index', {})

// 获取当前分类
export const getCurrentCategoryData = (params) => request.get('/catalog/current', {
  params
})

//获取产品分类列表数据
export const getCategoryListData = (params) => request.get('/goods/category', {
  params
})

//获取分类页面的商品列表

export const getCategoryGoodsListData = (params) => request.get('/goods/list', {
  params
})